@box_radius: 8px;
@hair_color: rgba(0, 0, 0, 0.3);
@modal_theme_color: #fff;
@modal_duration: 200ms;
@modal_footer_height: 80px;

/*hair-border*/
.hairline(@position, @color) {
  &::before,
  &::after {
    position: absolute;
    left: 0;
    right: auto;
    background-color: @color;
    display: block;
    z-index: 15;
  }
  &:before {
    top: 0;
    bottom: auto;
    & when (@position = top) {
      content: '';
      height: 1px;
      width: 100%;
      transform-origin: 50% 0%;
      html[tag='pixel-ratio-2'] & {
        transform: scaleY(0.5);
      }
      html[tag='pixel-ratio-3'] & {
        transform: scaleY(0.33);
      }
    }
  }
  &:after {
    top: auto;
    bottom: 0;
    & when (@position = bottom) {
      content: '';
      height: 1px;
      width: 100%;
      html[tag='pixel-ratio-2'] & {
        transform: scaleY(0.5);
      }
      html[tag='pixel-ratio-3'] & {
        transform: scaleY(0.33);
      }
    }
  }
  &:after {
    left: auto;
    right: 0;
    & when (@position = right) {
      content: '';
      height: 100%;
      width: 1px;
      html[tag='pixel-ratio-2'] & {
        transform: scaleX(0.5);
      }
      html[tag='pixel-ratio-3'] & {
        transform: scaleX(0.33);
      }
    }
  }
}

.modal {
  position: fixed;
  z-index: 11;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  // animation: zoomIn 400ms;
  :global {
    animation: zoomIn 300ms;
  }
  &.hide {
    :global {
      animation: zoomOut 300ms;
    }
  }
  .modal_inner {
    min-width: 20em;
    overflow: hidden;
    border-radius: @box_radius;
    background: @modal_theme_color;
    z-index: 12;
    .modal_header {
      font-size: 30px;
      padding: 40px;
      text-align: center;
      position: relative;
      color: #333333;
      .modal_header_title {
        font-weight: 700;
        margin: 0;
        line-height: 32px;
      }
    }

    .modal_main,
    .prompt_wrap {
      min-height: 3em;
      text-align: center;
      color: #999999;
      padding: 0 24px 24px;
      .input {
        height: 78px;
        background: #f1f1f1;
        border-radius: @box_radius;
        border: 0;
        text-indent: 20px;
        font-size: 28px;
        width: 98%;
        color: #999999;
      }
    }

    .modal_footer {
      height: @modal_footer_height;
      position: relative;
      display: flex;
      justify-content: center;
      .hairline(top, @hair_color);
      .button {
        width: 100%;
        padding: 0 10px;
        height: @modal_footer_height;
        line-height: @modal_footer_height;
        font-size: 30px;
        text-align: center;
        display: block;
        position: relative;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        cursor: pointer;
        box-sizing: border-box;
        flex: 1;
        border: none;
        background: none;
        color: #999999;
        &:not(:last-child) {
          .hairline(right, @hair_color);
        }
        &:last-child {
          color: #0f6eff;
          // font-weight: 500;
          html.ios-gt-8 & {
            font-weight: 600;
          }
        }
      }
    }
  }
}

.modal_mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
  visibility: visible;
  opacity: 1;
  animation: showModalAnimation 400ms;
  &.hide {
    visibility: hidden;
    opacity: 0;
    transition-duration: @modal_duration;
  }
}
